import 'package:flutter/material.dart';
import 'package:ducafe_ui_core/ducafe_ui_core.dart';

class CustomInputField extends StatelessWidget {
  final String? hintText;
  final bool obscureText;
  final TextEditingController? controller;
  final String? Function(String?)? validator;
  final TextInputType? keyboardType;
  final ValueChanged<String>? onChanged;
  final VoidCallback? onTap;
  final int? maxLength;
  final InputCounterWidgetBuilder? buildCounter;

  // ignore: use_super_parameters
  const CustomInputField({
    Key? key,
    this.hintText,
    this.obscureText = false,
    this.controller,
    this.validator,
    this.keyboardType,
    this.onChanged,
    this.onTap,
    this.maxLength,
    this.buildCounter,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
      decoration: BoxDecoration(
        color: Color.fromRGBO(255, 255, 255, 0.39),
        borderRadius: BorderRadius.circular(15.r),
      ),
      child: TextFormField(
        controller: controller,
        obscureText: obscureText,
        validator: validator,
        keyboardType: keyboardType,
        onChanged: onChanged,
        onTap: onTap,
        maxLength: maxLength,
        buildCounter: buildCounter,
        style: TextStyle(
          color: Colors.black87,
          fontSize: 16.sp,
          fontFamily: "Manrope",
        ),
        decoration: InputDecoration(
          hintText: hintText,
          hintStyle: TextStyle(
            color: Color.fromRGBO(255, 255, 255, 0.31),
            fontSize: 14.sp,
            fontFamily: 'Manrope',
            fontWeight: FontWeight.w400,
            height: 1.6, // 160% line height
            letterSpacing: 0.28,
            fontFeatures: const [
              FontFeature.disable('liga'),
              FontFeature.disable('clig'),
            ],
          ),
          counterStyle: TextStyle(color: Colors.white70, fontSize: 12.sp),
          border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(15.r),
            borderSide: BorderSide.none,
          ),
          contentPadding: EdgeInsets.symmetric(
            horizontal: 20.w,
            vertical: 16.h,
          ),
        ),
      ),
    );
  }
}
